from store_data_in_kg import (
  store_movie_info_node,
  store_movie_keyword_node,
  store_movie_crew_node,

  store_data_for_relationship_movie_info,
  store_data_for_relationship_movie_keyword,
  store_data_for_relationship_movie_crew
)
from neo4j import (
  clear_graph,
  clear_relationship,
  delete_relationship_by_type,
  clear_node_by_type
)
from utils import (
  record_run_time,
  log_message
)
from consts import (
  RELATIONSHIP_MOVIE_TO_ORIGIN_LANGUAGE,
  RELATIONSHIP_MOVIE_TO_PRODUCTION_COMPANY,
  RELATIONSHIP_MOVIE_TO_PRODUCTION_COUNTRY,
  RELATIONSHIP_MOVIE_TO_KEYWORD,
  RELATIONSHIP_MOVIE_TO_CREW,

  NODE_CREW
)

def main():
  # 清空节点
  # clear_graph()
  # 存储关于info数据相关的实体节点
  # 包括：电影,类型,电影原始语言,电影制作公司,电影制作国家,
  # record_run_time(store_movie_info_node)

  # # 存储关键词节点
  # record_run_time(store_movie_keyword_node)

  # 存储电影人员节点
  # clear_node_by_type(NODE_CREW)
  # record_run_time(store_movie_crew_node)

  # log_message("实体节点存储完毕")
  
  # 清空所有实体关系
  # clear_relationship()

  
  # delete_relationship_by_type(RELATIONSHIP_MOVIE_TO_ORIGIN_LANGUAGE)
  # delete_relationship_by_type(RELATIONSHIP_MOVIE_TO_PRODUCTION_COMPANY)
  # delete_relationship_by_type(RELATIONSHIP_MOVIE_TO_PRODUCTION_COUNTRY)
  # log_message("开始存储实体关系")
  # store_data_for_relationship_movie_info()

  # 电影-关键词
  # delete_relationship_by_type(RELATIONSHIP_MOVIE_TO_KEYWORD)
  # store_data_for_relationship_movie_keyword()

  # 电影-演员
  # 电影-制作人员
  delete_relationship_by_type(RELATIONSHIP_MOVIE_TO_CREW)
  store_data_for_relationship_movie_crew()



if __name__ == "__main__":
  main()
